# Contributor: Michael Zuo <muh.muhten@gmail.com>
# Contributor: Sora Morimoto <sora@morimoto.io>
# Contributor: Anil Madhavapeddy <anil@recoil.org>
# Contributor: omni <omni+alpine@hack.org>
# Maintainer: Kate <kit.ty.kate@disroot.org>
pkgname=opam
pkgver=2.1.2
pkgrel=2
pkgdesc="OCaml Package Manager"
url="https://opam.ocaml.org"
arch="all !riscv64" # ocaml
license="LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
depends="curl patch unzip coreutils bubblewrap"
options="net !check" # The tests use bubblewrap which cannot be run inside docker
makedepends="curl tar ocaml-compiler-libs"
checkdepends="rsync bash diffutils"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocaml/opam/archive/$pkgver.tar.gz"
subpackages="$pkgname-doc"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-mccs

	make -j1 lib-ext
	make -j1 all
}

check() {
	make tests
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
bea6f75728a6ef25bcae4f8903dde7a297df7186208dccacb3f58bd6a0caec551c11b79e8544f0983feac038971dbe49481fc405a5962973a5f56ec811abe396  opam-2.1.2.tar.gz
"
